package terra.model.object.action;

import terra.managers.ThreadPoolManager;
import terra.model.object.ai.AbstractAI;

public class ActionWait extends AbstractAction {

	private static final long serialVersionUID = -3857824218204807353L;
	int time;

	public ActionWait(AbstractAI ai, int time) {
		super(AbstractAI.ACTION_WAIT, ai);
		this.time = time;
	}

	@Override
	public void update(int delta) {
		ai.setWait(true);
		ThreadPoolManager.getInstance().scheduleGeneral(new Runnable() {

			@Override
			public void run() {
				ai.setWait(false);

			}
		}, time);
		// time-=delta;
		// if (time <= 0)
		end();
	}

}
